﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BaseSet.Data;
using BaseSet.Logic;
using BaseSet.Entity;
using BaseSet.Framework;
using BaseSet.Entity.Common;
using BaseSet.Entity.Common.Text;
using BaseSet;
using System.Data;

namespace WebSite.Admin.SystemSet
{
    public partial class SystemConfigSet : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadContent();
            }
        }

        #region 加载信息
        private void LoadContent()
        {
            SystemConfig scinfo = new SystemConfig();
            SystemConfigHelper schelper = new SystemConfigHelper();
            scinfo = schelper.GetSystemConfig("1");

            txtBlogMoneyNum.Text = scinfo.BlogMoneyNum.ToString();
            txtBlogMoney.Text = scinfo.BlogMoney.ToString();

            txtRecommandRegisterNum.Text = scinfo.RecommandRegisterMoneyNum.ToString();
            txtRecommandRegisterMoney.Text = scinfo.RecommandRegisterMoney.ToString();

            txtIndexInfo.Text = scinfo.IndexInfo.ToString();
            txtRegisterInfo.Text = scinfo.RecommandRegisterInfo.ToString();
        }
        #endregion

        #region 博客个数提交
        protected void btnBlogMoneyNum_Click(object sender, EventArgs e)
        {
            SystemConfig scinfo = new SystemConfig();
            SystemConfigHelper schelper = new SystemConfigHelper();
            scinfo = schelper.GetSystemConfig("1");
            scinfo.BlogMoneyNum =Convert.ToInt32( txtBlogMoneyNum.Text.Trim());
            schelper.EditSystemConfig(scinfo);
        }
        #endregion

        #region 博客金额提交
        protected void btnBlogMoney_Click(object sender, EventArgs e)
        {
            SystemConfig scinfo = new SystemConfig();
            SystemConfigHelper schelper = new SystemConfigHelper();
            scinfo = schelper.GetSystemConfig("1");
            scinfo.BlogMoney = (float)Convert.ToDouble(txtBlogMoney.Text.Trim());
            schelper.EditSystemConfig(scinfo);
        }
        #endregion

        #region 推荐好友奖励个数提交
        protected void btnRecommandRegisterNum_Click(object sender, EventArgs e)
        {
            SystemConfig scinfo = new SystemConfig();
            SystemConfigHelper schelper = new SystemConfigHelper();
            scinfo = schelper.GetSystemConfig("1");
            scinfo.RecommandRegisterMoneyNum = Convert.ToInt32(txtRecommandRegisterNum.Text.Trim());
            schelper.EditSystemConfig(scinfo);
        }
        #endregion

        #region 推荐好友奖励金额提交
        protected void btnRecommandRegisterMoney_Click(object sender, EventArgs e)
        {
            SystemConfig scinfo = new SystemConfig();
            SystemConfigHelper schelper = new SystemConfigHelper();
            scinfo = schelper.GetSystemConfig("1");
            scinfo.RecommandRegisterMoney = (float)Convert.ToDouble(txtRecommandRegisterMoney.Text.Trim());
            schelper.EditSystemConfig(scinfo);
        }
        #endregion

        #region 宣传自己个人主页信息提交
        protected void btnIndexInfo_Click(object sender, EventArgs e)
        {
            SystemConfig scinfo = new SystemConfig();
            SystemConfigHelper schelper = new SystemConfigHelper();
            scinfo = schelper.GetSystemConfig("1");
            scinfo.IndexInfo = txtIndexInfo.Text.Trim();
            schelper.EditSystemConfig(scinfo);
        }
        #endregion

        #region 宣传自己推荐注册信息提交
        protected void btnRegisterInfo_Click(object sender, EventArgs e)
        {
            SystemConfig scinfo = new SystemConfig();
            SystemConfigHelper schelper = new SystemConfigHelper();
            scinfo = schelper.GetSystemConfig("1");
            scinfo.RecommandRegisterInfo = txtRegisterInfo.Text.Trim();
            schelper.EditSystemConfig(scinfo);
        }
        #endregion

        #region 博客PV最大金额
        protected void btnBlogMaxPVMoney_Click(object sender, EventArgs e)
        {
            SystemConfig scinfo = new SystemConfig();
            SystemConfigHelper schelper = new SystemConfigHelper();
            scinfo = schelper.GetSystemConfig("1");
            scinfo.BlogMaxPVMoney = Convert.ToInt32(txtBlogMaxPVMoney.Text.Trim());
            schelper.EditSystemConfig(scinfo);
        }
        #endregion
    }
}